﻿@{
    ViewBag.Title = "AdminLogin";
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>在线考试终端</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <!-- load css -->
    <link type="text/css" href="~/common/layui/css/layui.css" rel="stylesheet" media="all" />
    <link href="~/content/css/login.css" rel="stylesheet" />
</head>
<body>
    <div class="layui-canvs"></div>
    <div class="layui-layout layui-layout-login">
        <h1>
            <strong>在线考试终端---学生</strong>
            <em>Exam Admin</em>
        </h1>
        <div class="layui-user-icon larry-login">
            <input type="text" placeholder="账号" id="Name" class="login_txtbx" />
        </div>
        <div class="layui-pwd-icon larry-login">
            <input type="password" placeholder="密码" id="Password" class="login_txtbx" />
        </div>
        <div class="layui-submit larry-login">
            <input type="button" value="立即登陆" onclick="Login()" class="submit_btn" />
        </div>
        <div class="layui-login-text">
            <p>© 2016-2017 Larry 版权所有</p>
            <p>第五项目组 <a href="http://www.qinshouwei.com" title="">qinshouwei.com</a></p>
        </div>
    </div>
    <script type="text/javascript" src="~/common/layui/lay/dest/layui.all.js"></script>
    <script type="text/javascript" src="~/content/js/login.js"></script>
    <script type="text/javascript" src="~/content/jsplug/jparticle.jquery.js"></script>
    <script type="text/javascript"></script>
    <script src="~/content/js/jquery-1.10.2.min.js"></script>

    <script>

        //管理员登录方法
        function Login() {
            var name = $("#Name").val();
            var pwd = $("#Password").val();
            if (name == "") {
                alert("用户名为空");

            }
            else
            {
                if (pwd == "") {
                    alert("密码为空");

                }
                else
                {
                    $.ajax({
                        type: "get",
                        url: "http://localhost:60031/api/Student/GetStudentLogin",
                        data: {
                            name: name,
                            pwd: pwd
                        },
                        success: function (res)
                        {
                            if (res[0].stuid > 0)
                            {
                                alert("登录成功");
                                var student = window.localStorage;
                                student.setItem("stuid", res[0].stuid)//id
                                student.setItem("stuname", res[0].stuname)//姓名
                                student.setItem("stuclass", res[0].stuclass)//班级
                                student.setItem("stuage", res[0].stuage)//年龄
                                student.setItem("major", res[0].major)//专业
                                student.setItem("dapartment", res[0].dapartment)//系
                                student.setItem("password", res[0].password)//密码
                                student.setItem("purviewid", res[0].purviewid)//权限
                                student.setItem("note", res[0].note)//注释

                                location.href = "/Student/index";
                            }
                            else
                            {
                                alert("登录失败");
                            }

                        }
                    })

                }
               
            }
           
        }

    </script>


</body>
</html>
